"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
const fs = __importStar(require("fs"));
const path_1 = __importDefault(require("path"));
const lib_css_1 = __importDefault(require("../../../../../../@libs/nodejs-lib-main/lib_css"));
const config_1 = __importDefault(require("../../../../../config"));
const control_panel_1 = __importDefault(require("../control_panel/control_panel"));
const element_plus_1 = require("element-plus");
const component = {
    template: fs.readFileSync(`${__dirname}/node_panel.html`, "utf-8"),
    // style: fs.readFileSync(`${__dirname}/node_panel.css`, "utf-8"),
    name: 'node_panel',
    components: { ControlPanel: control_panel_1.default },
    props: {
        lf: Object,
        nodeList: Array,
    },
    methods: {
        $_dragNode(item) {
            console.log("拽取", item);
            let startNodeCount = 0;
            const allData = this.$props.lf.getGraphData();
            allData.nodes.forEach(node => {
                if (node.type === 'startNode') {
                    startNodeCount++;
                }
            });
            console.log('startNodeCount节点的个数为:', startNodeCount);
            if (item.type == 'startNode' && startNodeCount >= 1) {
                element_plus_1.ElMessage.error('当前图数据只能有一个开始节点');
            }
            else {
                this.$props.lf.dnd.startDrag({
                    type: item.type,
                });
            }
        }
    },
    mounted() {
        // 加载 css
        lib_css_1.default.load([
            {
                parent: this.$el,
                url_s: path_1.default.join(config_1.default.root_path_s, "src/panel//logicflow/components/LFCompoents", "node_panel", "node_panel.css"),
            },
        ]);
    }
};
module.exports = component;
